home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / OS2 / VD08BIN.ZIP / usr / include / util / organizedfile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-13  |  1.7 KB  |  64 lines

  1. /* -------------------------------------------------------------------
  2.  
  3.     Project: General utility classes
  4.  
  5.     Objective-C interface file for the class organizedfile
  6.  
  7.     COPYRIGHT (C), 1995, Thomas Baier
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Date:                Rev: 0.1
  11.     1995-Jul-17            ___
  12.  
  13.  */
  14.  
  15. #ifndef _ORGANIZEDFILE_H_
  16. #define _ORGANIZEDFILE_H_
  17. /*====================================================================
  18.                    Interface of class organizedfile                   
  19. ====================================================================*/
  20. #include <util/File.h>
  21.  
  22. /*
  23.  * This structure is used to maintain a list of all free pages in the
  24.  * data file. The first free list page is the first page in the file.
  25.  * In this case, the variable prevPage points to the actual root page of
  26.  * the data file.
  27.  */
  28. typedef struct _FREELIST {
  29.   long prevPage;
  30.   long nextPage;
  31.   long count;
  32.   long pages[0];
  33. } FREELIST;
  34.  
  35. @interface OrganizedFile : File
  36. {
  37.   FREELIST *freeList;
  38.   long      freePage;
  39.   long      rootPage;
  40. }
  41.  
  42. /* -------------------------- Initialize -------------------------- */
  43. -init;
  44. -initForReading: (char *) string recordSize: (long) aRecSize;
  45. -initForWriting: (char *) string recordSize: (long) aRecSize;
  46. -createForWriting: (char *) string recordSize: (long) aRecSize;
  47.  
  48. /* ----------------------------- Free ----------------------------- */
  49. -free;
  50.  
  51. /* ----------- Methods for access to Instance Variables ----------- */
  52. -setRootPage: (long) aPage;
  53. -(long) rootPage;
  54.  
  55. /* ------------------------ Public methods ------------------------ */
  56. -(long) append: (void *) record;
  57. -(long) delete;
  58. -(long) delete: (long) index;
  59.  
  60. /* ----------------------- Private methods ------------------------ */
  61.  
  62. @end
  63. #endif
  64.